// -*- c-basic-offset: 2 default-tab-width: 2 indent-tabs-mode: t -*-
// vim: autoindent tabstop=2 noexpandtab shiftwidth=2 softtabstop=2
//===------------ main.cpp - Simple execution of Reactor ----------------===//
//
//                          The VMKit project
//
// This file is distributed under the Purdue University Open Source
// License. See LICENSE.TXT for details.
//
//===--------------------------------------------------------------------===//

#include "Reactor.h"
#include "Array.h"
#include "RJITCompiler.h"
#include "vmkit/JIT.h"

using namespace R;
using namespace vmkit;

static void usage(int argc, char** argv) {
  fprintf(stderr, "Usage: %s [-d|-s] R-file\n", argv[0]);
  exit(42);
}

extern CompiledFrames* frametables[];
	//#include "FrametablesSymbols.inc"
//    NULL
//};

int main(int argc, char **argv){
  // Initialize base components.  
  VmkitModule::initialise(argc, argv);
  Collector::initialise(argc, argv);

  // Create the allocator that will allocate the bootstrap loader and the JVM.
  vmkit::BumpPtrAllocator Allocator;
  RJITCompiler* Comp = RJITCompiler::create();
  Reactor* vm = new(Allocator, "VM") Reactor(Allocator, Comp, frametables);

  // Run the application. 
  vm->runApplication(argc, argv);
  vm->waitForExit();
  System::Exit(0);

  return 0;
}
